<?php
namespace app\index\model;

use think\Model;

class AvLog extends Model
{
    protected $table = 'sn_av_log';
    //关联用户表
    public function user()
    {
        return $this->belongsTo('User', 'uid', 'id');
    }
    //关联直播间表
    public function room()
    {
        return $this->belongsTo('Room','room_id','id');
    }
    /** 直播记录
     * @param $map
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function query_list($map)
    {
        return $this->relation(array('user','room'))->where($map)->paginate();
    }
}